<template>
  <div>
      <el-table
        :data="data"
        :style="{textAlign: 'center'}"
        border>
        <el-table-column
          prop="title"
          label="文章"
          width="400">
        </el-table-column>

        <el-table-column
          prop="username"
          width="250"
          label="文章作者">
        </el-table-column>

        <el-table-column
          prop="CommentContent"
          label="评论内容"
          width="300">
        </el-table-column>

        <el-table-column
          prop="createTime"
          width="300"
          label="评论时间">
        </el-table-column>


        <el-table-column
          label="操作"
          v-show="theoppr"
          :width="100">
          <template slot-scope="scope">
            <div style="text-align: center;">
              <el-button type="text" size="small" >删除</el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>

      <el-pagination
      :style="{margin:10+'px'}"
          background
          layout="prev, pager, next"
          @current-change="getNowPageNum"
          :total="this.total">
      </el-pagination>
  </div>
</template>

<style>
  .el-table .warning-row {
    background: oldlace;
  }

  .el-table .success-row {
    background: #f0f9eb;
  }
</style>

<script>
  import {formatDate} from '@/common/utils.js'
  import CommentApi from '@/api/Commont.js'
  import mixins from '@/mixins.js'
  export default {
    mixins:[mixins],
    methods:{
    },
    data() {
      return {
        data:[],
        pageSize:15,
        total:10
      }
    },
    created() {
      CommentApi.commentget(this.UserInfo.id).then(res => {
        this.data = res.data

        for(var i=0;i<this.data.length;i++){
          this.data[i].createTime = formatDate(this.data[i].createTime,"yyyy-MM-dd hh:mm:ss")
        }
      })
    }
  }
</script>
